package com.shop.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.pojo.sms.Sms_Seckill_Session;
import com.shop.pojo.sms.Sms_Seckill_promotion;
import com.shop.service.Sms_Seckill_Session_Service;
import com.shop.utils.LayuiUtils;
import com.shop.utils.R;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
/**
 * 秒杀活动场次
 */
@RestController
@RequestMapping("/seckill_session")
public class Sms_Seckill_Session_Controller {

    @Autowired
    private Sms_Seckill_Session_Service sms_seckill_session_service;

//查询全部活动场次和每个场次下的sku商品
    @GetMapping("/findAllSeckillSessionBySku")
    public R findAllSeckillSessionBySku(){
        return sms_seckill_session_service.findAllSeckill3DaysSession();
    }

    /***
     * 后台查询每日秒杀活动
     * @param page
     * @param limit
     * @param sss
     * @return
     */
    @GetMapping("/find_admin_Mei_Ri_All")
    public LayuiUtils<Sms_Seckill_Session>  find_admin_Mei_Ri_All(Integer page,Integer limit,Sms_Seckill_Session sss){

//        Page<Sms_Seckill_Session> PAGES = new Page<>(page,limit);

        return sms_seckill_session_service.find_admin_Mei_Ri_All(page-1,limit,sss);

    }





    /**
     * 后台秒杀活动场次的显示
     * @param page
     * @param limit
     * @param sss
     * @return
     */
    @GetMapping("/find_admin_seckill_session_All")
    public LayuiUtils<Sms_Seckill_Session> find_admin_seckill_session_All(Integer page, Integer limit, Sms_Seckill_Session sss)
    {
        Page<Sms_Seckill_Session>  Pages = new Page<>(page,limit);

        return sms_seckill_session_service.find_admin_seckill_session_All(Pages,sss);
    }

    /**
     * 后台秒杀活动场次的新增
     * @param sss
     * @return
     */
    @PostMapping("/insert_admin_seckill_session_All")
    public R  insert_admin_seckill_session_All(Sms_Seckill_Session sss){
        return sms_seckill_session_service.insert_admin_seckill_session_All(sss);
    }

    /***
     * 后台秒杀活动场次的删除
     * @param id
     * @return
     */
    @DeleteMapping("/del_admin_seckill_session_All")
    public R del_admin_seckill_session_All(@RequestParam List<Integer> id){

        return sms_seckill_session_service.del_admin_seckill_session_All(id);
    }

    /**
     * 后台秒杀活动场次的修改
     * @param sss
     * @return
     */
    @PutMapping("/up_admin_seckill_session_All")
    public R  up_admin_seckill_session_All(Sms_Seckill_Session sss){
        return sms_seckill_session_service.up_admin_seckill_session_All(sss);
    }



}
